package com.application.actor.pojo;

import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.mina.core.session.IoSession;

import com.application.item.pojo.ActorHoldItem;
import com.application.item.pojo.Part;
import com.core.utils.Constants;

public class Actor {
	private int id;
	private int userId;
	private String userName;
	private String nickname;
	private long sessionId;
	private IoSession session;
	private byte sex;
	private int exp;
	private int level;
	private Date createDate;
	private Date loginDate;
	private byte state;
	private int mapId;
	private int x;
	private int y;
	private int money;
	private int avaterId;
	private int bagSize;
	
	public ActorHoldItem nowCar;
	private int extBagSpace=0;
	public Map<Byte,ActorHoldItem> partList = new ConcurrentHashMap<Byte, ActorHoldItem>();
	public Map<Byte,Byte> skillMap = new ConcurrentHashMap<Byte, Byte>();
	
	public int roomId;
	public long roomCreateTime;
	public int chatmode;
	public boolean offLine = false;
	public long lastUpdateTime = System.currentTimeMillis();
	public boolean dataChanged =false;
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}
	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}
	/**
	 * @return the userId
	 */
	public int getUserId() {
		return userId;
	}
	/**
	 * @param userId the userId to set
	 */
	public void setUserId(int userId) {
		this.userId = userId;
	}
	/**
	 * @return the nickName
	 */
	public String getNickname() {
		return nickname;
	}
	/**
	 * @param nickName the nickName to set
	 */
	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	/**
	 * @return the sessionId
	 */
	public long getSessionId() {
		return sessionId;
	}
	/**
	 * @param sessionId the sessionId to set
	 */
	public void setSessionId(long sessionId) {
		this.sessionId = sessionId;
	}
	/**
	 * @return the session
	 */
	public IoSession getSession() {
		return session;
	}
	/**
	 * @param session the session to set
	 */
	public void setSession(IoSession session) {
		this.session = session;
	}
	/**
	 * @return the userName
	 */
	public String getUserName() {
		return userName;
	}
	/**
	 * @param userName the userName to set
	 */
	public void setUserName(String userName) {
		this.userName = userName;
	}
	/**
	 * @return the sex
	 */
	public byte getSex() {
		return sex;
	}
	/**
	 * @param sex the sex to set
	 */
	public void setSex(byte sex) {
		this.sex = sex;
	}
	/**
	 * @return the exp
	 */
	public int getExp() {
		return exp;
	}
	/**
	 * @param exp the exp to set
	 */
	public void setExp(int exp) {
		this.exp = exp;
	}
	/**
	 * @return the level
	 */
	public int getLevel() {
		return level;
	}
	/**
	 * @param level the level to set
	 */
	public void setLevel(int level) {
		this.level = level;
	}
	/**
	 * @return the createDate
	 */
	public Date getCreateDate() {
		return createDate;
	}
	/**
	 * @param createDate the createDate to set
	 */
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	/**
	 * @return the state
	 */
	public byte getState() {
		return state;
	}
	/**
	 * @param state the state to set
	 */
	public void setState(byte state) {
		this.state = state;
	}
	/**
	 * @return the loginDate
	 */
	public Date getLoginDate() {
		return loginDate;
	}
	/**
	 * @param loginDate the loginDate to set
	 */
	public void setLoginDate(Date loginDate) {
		this.loginDate = loginDate;
	}
	/**
	 * @return the mapId
	 */
	public int getMapId() {
		return mapId;
	}
	/**
	 * @param mapId the mapId to set
	 */
	public void setMapId(int mapId) {
		this.mapId = mapId;
	}
	/**
	 * @return the x
	 */
	public int getX() {
		return x;
	}
	/**
	 * @param x the x to set
	 */
	public void setX(int x) {
		this.x = x;
	}
	/**
	 * @return the y
	 */
	public int getY() {
		return y;
	}
	/**
	 * @param y the y to set
	 */
	public void setY(int y) {
		this.y = y;
	}
	/**
	 * @return the money
	 */
	public int getMoney() {
		return money;
	}
	/**
	 * @param money the money to set
	 */
	public void setMoney(int money) {
		this.money = money;
	}
	/**
	 * @return the avaterId
	 */
	public int getAvaterId() {
		return avaterId;
	}
	/**
	 * @param avaterId the avaterId to set
	 */
	public void setAvaterId(int avaterId) {
		this.avaterId = avaterId;
	}
	/**
	 * @return the bagSize
	 */
	public int getCunnrentBagSize() {
		if(extBagSpace>100) extBagSpace=100;
		int size = this.bagSize+ this.level/5 +extBagSpace;
		return size;
	}
	public int getBagSize() {
		return this.bagSize;
	}
	/**
	 * @param bagSize the bagSize to set
	 */
	public void setBagSize(int bagSize) {
		if(bagSize==0){
			this.bagSize =Constants.DFT_BAG_SIZE;
			this.dataChanged=true;
		}else{
			this.bagSize = bagSize;
		}
		
	}

	
}
